package state;

import particle.core.tools.ITimerTickEventHandler;
import particle.core.tools.Timer;
import particle.core.tools.TimerTickEvent;

public class GameControl implements ITimerTickEventHandler {
  private Timer timer = new Timer();
  private int timeInterval = 10;
  
  private boolean repeat = false;

  public GameControl() {
  }
  
  public void start() {
    timer.addTickEventHandler(this);
    timer.start(timeInterval, repeat);
  }
  
  public GameControl setRepeat(boolean repeat1) {
    repeat = repeat1;
    return this;
  }

  public int getTimeInterval() {
    return timeInterval;
  }

  public GameControl setTimeInterval(int timeInterval1) {
    this.timeInterval = timeInterval1;
    if (timer.isRunning()) {
      restart();
    }
    return this;
  }

  public void onTimerTick(Timer paramTimer, TimerTickEvent paramTimerTickEvent) {
    perform();
  }

  public void restart() {
    stop();
    timer.start(timeInterval, repeat);
  }

  public void stop() {
    timer.stop();
  }

  public void perform() {
  }
}
